package rejeev.btrace.services;

import rejeev.btrace.model.BTraceModel;
import rejeev.btrace.model.Employee;

import java.lang.reflect.Method;

/**
 * Created with IntelliJ IDEA.
 * User: rejeev
 * Date: 10/13/13
 * Time: 3:46 PM
 * To change this template use File | Settings | File Templates.
 */
public class AdminService {
    public String startTrace(String className, String methodName) throws Exception {
        Class<?> aClass = Class.forName(className);
        String str = startTrace(aClass, methodName);
        return str;
    }

    public String startTrace(Class klass, String method) throws Exception {
        Method method1 = klass.getMethod(method);
        String str = startTrace(klass, method1);
        return str;
    }

    private String startTrace(Class klass, Method method){
        Employee employee = new Employee();
        employee.setName("afdsfd");
        employee.getName();
        BTraceModel bTraceModel = new BTraceModel();
        bTraceModel.setKlass(klass);
        bTraceModel.getKlass();
        String display = "class: " + klass.getName() + " method: " + method.getName();
        System.out.println(display);
        return display;
    }
}
